<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- Copyright © 1988-2023 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Funding Free Software", the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below).  A copy of the license is included in the section entitled
"GNU Free Documentation License".

(a) The FSF's Front-Cover Text is:

A GNU Manual

(b) The FSF's Back-Cover Text is:

You have freedom to copy and modify this GNU Manual, like GNU
     software.  Copies published by the Free Software Foundation raise
     funds for GNU development. -->
<title>Library Calls (GNU Compiler Collection (GCC) Internals)</title>

<meta name="description" content="Library Calls (GNU Compiler Collection (GCC) Internals)">
<meta name="keywords" content="Library Calls (GNU Compiler Collection (GCC) Internals)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">

<link href="index.html" rel="start" title="Top">
<link href="Option-Index.html" rel="index" title="Option Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Target-Macros.html" rel="up" title="Target Macros">
<link href="Addressing-Modes.html" rel="next" title="Addressing Modes">
<link href="Trampolines.html" rel="prev" title="Trampolines">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
span:hover a.copiable-link {visibility: visible}
strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
-->
</style>


</head>

<body lang="en">
<div class="section-level-extent" id="Library-Calls">
<div class="nav-panel">
<p>
Next: <a href="Addressing-Modes.html" accesskey="n" rel="next">Addressing Modes</a>, Previous: <a href="Trampolines.html" accesskey="p" rel="prev">Support for Nested Functions</a>, Up: <a href="Target-Macros.html" accesskey="u" rel="up">Target Description Macros and Functions</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h3 class="section" id="Implicit-Calls-to-Library-Routines"><span>18.12 Implicit Calls to Library Routines<a class="copiable-link" href="#Implicit-Calls-to-Library-Routines"> &para;</a></span></h3>
<a class="index-entry-id" id="index-library-subroutine-names"></a>
<a class="index-entry-id" id="index-libgcc_002ea"></a>

<p>Here is an explanation of implicit calls to library routines.
</p>
<dl class="first-deffn first-defmac-alias-first-deffn">
<dt class="deffn defmac-alias-deffn" id="index-DECLARE_005fLIBRARY_005fRENAMES"><span class="category-def">Macro: </span><span><strong class="def-name">DECLARE_LIBRARY_RENAMES</strong><a class="copiable-link" href="#index-DECLARE_005fLIBRARY_005fRENAMES"> &para;</a></span></dt>
<dd><p>This macro, if defined, should expand to a piece of C code that will get
expanded when compiling functions for libgcc.a.  It can be used to
provide alternate names for GCC&rsquo;s internal library functions if there
are ABI-mandated names that the compiler should provide.
</p></dd></dl>

<a class="index-entry-id" id="index-set_005foptab_005flibfunc"></a>
<a class="index-entry-id" id="index-init_005fone_005flibfunc"></a>
<dl class="first-deftypefn">
<dt class="deftypefn" id="index-TARGET_005fINIT_005fLIBFUNCS"><span class="category-def">Target Hook: </span><span><code class="def-type">void</code> <strong class="def-name">TARGET_INIT_LIBFUNCS</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-TARGET_005fINIT_005fLIBFUNCS"> &para;</a></span></dt>
<dd><p>This hook should declare additional library routines or rename
existing ones, using the functions <code class="code">set_optab_libfunc</code> and
<code class="code">init_one_libfunc</code> defined in <samp class="file">optabs.cc</samp>.
<code class="code">init_optabs</code> calls this macro after initializing all the normal
library routines.
</p>
<p>The default is to do nothing.  Most ports don&rsquo;t need to define this hook.
</p></dd></dl>

<dl class="first-deftypevr">
<dt class="deftypevr" id="index-TARGET_005fLIBFUNC_005fGNU_005fPREFIX"><span class="category-def">Target Hook: </span><span><code class="def-type">bool</code> <strong class="def-name">TARGET_LIBFUNC_GNU_PREFIX</strong><a class="copiable-link" href="#index-TARGET_005fLIBFUNC_005fGNU_005fPREFIX"> &para;</a></span></dt>
<dd><p>If false (the default), internal library routines start with two
underscores.  If set to true, these routines start with <code class="code">__gnu_</code>
instead.  E.g., <code class="code">__muldi3</code> changes to <code class="code">__gnu_muldi3</code>.  This
currently only affects functions defined in <samp class="file">libgcc2.c</samp>.  If this
is set to true, the <samp class="file">tm.h</samp> file must also
<code class="code">#define LIBGCC2_GNU_PREFIX</code>.
</p></dd></dl>

<dl class="first-deffn first-defmac-alias-first-deffn">
<dt class="deffn defmac-alias-deffn" id="index-FLOAT_005fLIB_005fCOMPARE_005fRETURNS_005fBOOL"><span class="category-def">Macro: </span><span><strong class="def-name">FLOAT_LIB_COMPARE_RETURNS_BOOL</strong> <var class="def-var-arguments">(<var class="var">mode</var>, <var class="var">comparison</var>)</var><a class="copiable-link" href="#index-FLOAT_005fLIB_005fCOMPARE_005fRETURNS_005fBOOL"> &para;</a></span></dt>
<dd><p>This macro should return <code class="code">true</code> if the library routine that
implements the floating point comparison operator <var class="var">comparison</var> in
mode <var class="var">mode</var> will return a boolean, and <var class="var">false</var> if it will
return a tristate.
</p>
<p>GCC&rsquo;s own floating point libraries return tristates from the
comparison operators, so the default returns false always.  Most ports
don&rsquo;t need to define this macro.
</p></dd></dl>

<dl class="first-deffn first-defmac-alias-first-deffn">
<dt class="deffn defmac-alias-deffn" id="index-TARGET_005fLIB_005fINT_005fCMP_005fBIASED"><span class="category-def">Macro: </span><span><strong class="def-name">TARGET_LIB_INT_CMP_BIASED</strong><a class="copiable-link" href="#index-TARGET_005fLIB_005fINT_005fCMP_005fBIASED"> &para;</a></span></dt>
<dd><p>This macro should evaluate to <code class="code">true</code> if the integer comparison
functions (like <code class="code">__cmpdi2</code>) return 0 to indicate that the first
operand is smaller than the second, 1 to indicate that they are equal,
and 2 to indicate that the first operand is greater than the second.
If this macro evaluates to <code class="code">false</code> the comparison functions return
&minus;1, 0, and 1 instead of 0, 1, and 2.  If the target uses the routines
in <samp class="file">libgcc.a</samp>, you do not need to define this macro.
</p></dd></dl>

<dl class="first-deffn first-defmac-alias-first-deffn">
<dt class="deffn defmac-alias-deffn" id="index-TARGET_005fHAS_005fNO_005fHW_005fDIVIDE"><span class="category-def">Macro: </span><span><strong class="def-name">TARGET_HAS_NO_HW_DIVIDE</strong><a class="copiable-link" href="#index-TARGET_005fHAS_005fNO_005fHW_005fDIVIDE"> &para;</a></span></dt>
<dd><p>This macro should be defined if the target has no hardware divide
instructions.  If this macro is defined, GCC will use an algorithm which
make use of simple logical and arithmetic operations for 64-bit
division.  If the macro is not defined, GCC will use an algorithm which
make use of a 64-bit by 32-bit divide primitive.
</p></dd></dl>

<a class="index-entry-id" id="index-EDOM_002c-implicit-usage"></a>
<a class="index-entry-id" id="index-matherr"></a>
<dl class="first-deffn first-defmac-alias-first-deffn">
<dt class="deffn defmac-alias-deffn" id="index-TARGET_005fEDOM"><span class="category-def">Macro: </span><span><strong class="def-name">TARGET_EDOM</strong><a class="copiable-link" href="#index-TARGET_005fEDOM"> &para;</a></span></dt>
<dd><p>The value of <code class="code">EDOM</code> on the target machine, as a C integer constant
expression.  If you don&rsquo;t define this macro, GCC does not attempt to
deposit the value of <code class="code">EDOM</code> into <code class="code">errno</code> directly.  Look in
<samp class="file">/usr/include/errno.h</samp> to find the value of <code class="code">EDOM</code> on your
system.
</p>
<p>If you do not define <code class="code">TARGET_EDOM</code>, then compiled code reports
domain errors by calling the library function and letting it report the
error.  If mathematical functions on your system use <code class="code">matherr</code> when
there is an error, then you should leave <code class="code">TARGET_EDOM</code> undefined so
that <code class="code">matherr</code> is used normally.
</p></dd></dl>

<a class="index-entry-id" id="index-errno_002c-implicit-usage"></a>
<dl class="first-deffn first-defmac-alias-first-deffn">
<dt class="deffn defmac-alias-deffn" id="index-GEN_005fERRNO_005fRTX"><span class="category-def">Macro: </span><span><strong class="def-name">GEN_ERRNO_RTX</strong><a class="copiable-link" href="#index-GEN_005fERRNO_005fRTX"> &para;</a></span></dt>
<dd><p>Define this macro as a C expression to create an rtl expression that
refers to the global &ldquo;variable&rdquo; <code class="code">errno</code>.  (On certain systems,
<code class="code">errno</code> may not actually be a variable.)  If you don&rsquo;t define this
macro, a reasonable default is used.
</p></dd></dl>

<dl class="first-deftypefn">
<dt class="deftypefn" id="index-TARGET_005fLIBC_005fHAS_005fFUNCTION"><span class="category-def">Target Hook: </span><span><code class="def-type">bool</code> <strong class="def-name">TARGET_LIBC_HAS_FUNCTION</strong> <code class="def-code-arguments">(enum function_class <var class="var">fn_class</var>, tree <var class="var">type</var>)</code><a class="copiable-link" href="#index-TARGET_005fLIBC_005fHAS_005fFUNCTION"> &para;</a></span></dt>
<dd><p>This hook determines whether a function from a class of functions
<var class="var">fn_class</var> is present in the target C library.  If <var class="var">type</var> is NULL,
the caller asks for support for all standard (float, double, long double)
types.  If <var class="var">type</var> is non-NULL, the caller asks for support for a
specific type.
</p></dd></dl>

<dl class="first-deftypefn">
<dt class="deftypefn" id="index-TARGET_005fLIBC_005fHAS_005fFAST_005fFUNCTION"><span class="category-def">Target Hook: </span><span><code class="def-type">bool</code> <strong class="def-name">TARGET_LIBC_HAS_FAST_FUNCTION</strong> <code class="def-code-arguments">(int <var class="var">fcode</var>)</code><a class="copiable-link" href="#index-TARGET_005fLIBC_005fHAS_005fFAST_005fFUNCTION"> &para;</a></span></dt>
<dd><p>This hook determines whether a function from a class of functions
<code class="code">(enum function_class)</code><var class="var">fcode</var> has a fast implementation.
</p></dd></dl>

<dl class="first-deffn first-defmac-alias-first-deffn">
<dt class="deffn defmac-alias-deffn" id="index-NEXT_005fOBJC_005fRUNTIME"><span class="category-def">Macro: </span><span><strong class="def-name">NEXT_OBJC_RUNTIME</strong><a class="copiable-link" href="#index-NEXT_005fOBJC_005fRUNTIME"> &para;</a></span></dt>
<dd><p>Set this macro to 1 to use the &quot;NeXT&quot; Objective-C message sending conventions
by default.  This calling convention involves passing the object, the selector
and the method arguments all at once to the method-lookup library function.
This is the usual setting when targeting Darwin/Mac OS X systems, which have
the NeXT runtime installed.
</p>
<p>If the macro is set to 0, the &quot;GNU&quot; Objective-C message sending convention
will be used by default.  This convention passes just the object and the
selector to the method-lookup function, which returns a pointer to the method.
</p>
<p>In either case, it remains possible to select code-generation for the alternate
scheme, by means of compiler command line switches.
</p></dd></dl>

</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="Addressing-Modes.html">Addressing Modes</a>, Previous: <a href="Trampolines.html">Support for Nested Functions</a>, Up: <a href="Target-Macros.html">Target Description Macros and Functions</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>
